package com.sky.mapper;

import com.sky.entity.DishFlavor;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @author 猛在王
 * @version 1.0
 * @date 25/5/2024 下午2:13
 * @description DishFlavorMapper 口味
 * @since 1.0
 */
@Mapper
public interface DishFlavorMapper {

    /**
     * 批量插入口味数据
     * @param flavors
     */
    void insertBatch(List<DishFlavor> flavors);

    /**
     * 通过菜品id来删除菜品口味
     * @param dishId
     */
    @Delete("delete from dish_flavor where dish_id = #{dishId}")
    void deleteDishFlavorById(Long dishId);

    /**
     * 通过菜品ids批量删除菜品口味
     * @param dishIds
     */
    void deleteByDishIds(List<Long> dishIds);

    /**
     * 通过菜品id来查询菜品口味
     * @param dishId
     * @return
     */
    @Select("select * from dish_flavor where dish_id = #{dishId}")
    List<DishFlavor> selectFlavorById(Long dishId);
}
